package com.jt.controller;

import com.jt.pojo.User;
import org.springframework.web.bind.annotation.*;

/**
 * @author :Colin
 * @version 创建时间: 2021/7/29 16:29
 */
@RestController
@CrossOrigin
public class AxiosController {
    /*查询用户信息
    * URL: Http://localhost:8090/axios/getUser
    * */
    @GetMapping("/axios/getUser")
    public String getUser(){
        return "hello Ajax入门";
    }
    @GetMapping("/axios/getUserById")
    public String getUser(Integer id){
        return "axios的id查询:"+id;
    }
    @GetMapping("/axios/User/{name}/{age}")
    public User getUser(User user){
        return user;
    }
    @GetMapping("/axios/User/getUserObj")
    public User getUserObj(User user){

        return user;
    }
    /*@PostMapping("/axios/insertUser")
    public User insertUser(User user){

        return user;
    }*/
    @PostMapping("/axios/insertUser")
    public User insertUser(@RequestBody User user){

        return user;
    }
    @PostMapping("/axios/user/{name}/{age}/{sex}")
    public User insertUserRest(User user){
        System.out.println("调用service入库");
        return user;
    }

}
